<template>
  <el-container class="layout-container">
    <el-aside width="200px">
      <div class="system-title">
        用户管理系统
      </div>
      <el-menu
        :default-active="route.path"
        class="el-menu-vertical"
        router
        background-color="#ffffff"
        text-color="#333333"
        active-text-color="#409EFF"
      >
        <el-menu-item index="/dashboard">
          <el-icon><HomeFilled /></el-icon>
          <span>首页</span>
        </el-menu-item>
        
        <el-sub-menu index="/user">
          <template #title>
            <el-icon><User /></el-icon>
            <span>用户管理</span>
          </template>
          <el-menu-item index="/user/list">用户列表</el-menu-item>
          <el-menu-item index="/user/permission">权限管理</el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>
    
    <el-container class="right-container">
      <el-header>
        <Header />
      </el-header>
      
      <el-main>
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script setup>
import { useRoute } from 'vue-router'
import { HomeFilled, User } from '@element-plus/icons-vue'
import Header from '../components/Header.vue'

const route = useRoute()
</script>

<style scoped>
.layout-container {
  height: 100vh;
  width: 100vw;
}

.right-container {
  width: calc(100% - 200px);
  background-color: #f5f7fa;
}

.el-header {
  background-color: #fff;
  border-bottom: 1px solid #ebeef5;
  height: 60px;
  padding: 0;
}

.el-aside {
  background-color: #fff;
  height: 100vh;
  border-right: 1px solid #ebeef5;
}

.el-menu {
  border-right: none;
}

.el-menu-vertical {
  height: calc(100% - 60px);
}

:deep(.el-menu-item) {
  height: 50px;
  line-height: 50px;
}

:deep(.el-sub-menu__title) {
  height: 50px;
  line-height: 50px;
}

:deep(.el-menu-item.is-active) {
  background-color: #ecf5ff !important;
  color: #409EFF !important;
  border-right: 2px solid #409EFF;
}

:deep(.el-menu-item:hover),
:deep(.el-sub-menu__title:hover) {
  background-color: #f5f7fa !important;
}

.el-main {
  padding: 20px;
  min-height: calc(100vh - 60px);
}

.system-title {
  height: 60px;
  line-height: 60px;
  text-align: center;
  font-size: 18px;
  font-weight: bold;
  color: #333;
  border-bottom: 1px solid #ebeef5;
}
</style>